﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AMS.DD35.DbLoader.Models;
using AMS.DD35.DbLoader.Views;

namespace AMS.DD35.DbLoader.Controllers
{
    class SkillController : EditorControllerBase, ISkillController
    {
        private ISkillModel _model;

        public SkillController()
        {
        }

        #region Initialization Methods
        protected override void InitializeFields()
        {
            // tightly couple here per MVC
            _model = new SkillModel();
            _browser = new BrowserDialog(this);
            _browser.NewButtonText = "New Skill";
            _browser.Text = "Skill Browser";

            IEnumerable<object> skill = _model.GetSkills();
            _browser.Populate(skill);
        }

        protected override void LoadEditor()
        {
            // TODO: prep editor to be Editor
            // Get data
            // Load data into Editor
            SkillEditor editor = new SkillEditor(this);
            // other load methods

            _editor = editor;
        }

        protected override void PrepNewEditor()
        {
            // prep editor to be New
            SkillEditor editor = new SkillEditor(this);

            _editor = editor;
        }
        #endregion

        // no brower; just new skill
        public override void Execute()
        {
            // TODO: Reconsider ability to browse and edit existing skills
            PrepNewEditor();
            _editor.ShowDialog();
        }

        public override void Accept()
        {
            // noop
        }

        public override void Cancel()
        {
            // noop
        }

        public override void Close()
        {
            // noop
        }

        public override void Edit()
        {
            // noop
        }
    }
}
